Debian 7.0
Sponsored Link

Basic Auth + LDAP
2013/05/11
 
Configure Apache2 and set a page that people must authenticate and the authentication is from LDAP server. Therefore it's necessarry to run LDAP server in your LAN.
[1] Following example shows 'test' directory requires an authentication.
root@www:~#
a2enmod ldap authnz_ldap
# enable modules

Enabling module ldap.
Considering dependency ldap for authnz_ldap:
Module ldap already enabled
Enabling module authnz_ldap.
To activate the new configuration, you need to run:
service apache2 restart
root@www:~#
vi /etc/apache2/conf.d/auth_ldap.conf
# create new

<IfModule authnz_ldap_module>
    <Directory /var/www/test>
        SSLRequireSSL
        AuthName "Authentication"
        AuthType Basic
        AuthBasicProvider ldap
        AuthLDAPURL ldap://master.srv.world/dc=srv,dc=world?uid?sub?(objectClass=*)
        Require ldap-filter objectClass=posixAccount
    </Directory>
</IfModule>

root@www:~#
/etc/init.d/apache2 restart

Restarting web server: apache2 ... waiting .
root@www:~#
vi /var/www/test/index.html
# create a test page

<html>
<body>
<div style="width: 100%; font-size: 40px; font-weight: bold; text-align: center;">
Test Page for LDAP Auth
</div>
</body>
</html>
  Access to the test page with web browser, then authentication is required as a config. Input user name on LDAP and authenticate here.
  Just accessed.
 
Tweet